package com.tuozixuan.transaction.user.service;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService1 {
    
    @Autowired
    private JdbcTemplate jdbcTemplate;
    
    @Autowired
    private UserService2 userService2;
    
    @Transactional/**(rollbackFor = IOException.class)*/
    public void updateMoney() throws IOException {
        
        jdbcTemplate.update("update user set money = money + ? where id = ?", 1000, 1);
        userService2.updateMoney();
        
        //throw new NoClassDefFoundError();
        //throw new RuntimeException();
        throw new IOException();
    }
}
